<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_tech_process" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="popProcedureChoice('&category_id=')" type='primary' size="mini">选择工序</el-button>
          <el-button @click="popProcessChar('')" type='primary' size="mini">查看流程图</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 工艺工序 </span>
          </div>
          <el-table :data="s_tech_process">
            <el-table-column label="工序名称" prop="process_name">
            </el-table-column>
            <el-table-column label="工序编号" prop="process_num">
            </el-table-column>
            <el-table-column label="变更状态" prop="process_state">
            </el-table-column>
            <el-table-column label="工序描述" prop="process_des">
            </el-table-column>
            <el-table-column label="工序管理员" prop="process_user">
            </el-table-column>
          </el-table>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'检测项目'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="ProcedureChoiceVisible" append-to-body>
      <ProcedureChoice v-if="ProcedureChoiceVisible" ref="ProcedureChoice" :popparams="popparams"> </ProcedureChoice>
    </el-dialog>
    <el-dialog :visible.sync="ProcessCharVisible" append-to-body>
      <ProcessChar v-if="ProcessCharVisible" ref="ProcessChar" :popparams="popparams"> </ProcessChar>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProcedureChoice from "@/views/mes/product/ProcedureChoice";
  import ProcessChar from "@/views/mes/product/ProcessChar";
  export default {
    name: 'TechProcedure',
    components: {
      ProcedureChoice,
      ProcessChar,
    },
    props: ['popparams'],
    data() {
      return {
        ProcedureChoiceVisible: false,
        ProcedureChoiceValue: null,
        ProcedureChoiceDesc: null,
        ProcessCharVisible: false,
        ProcessCharValue: null,
        ProcessCharDesc: null,
        vueparams: this.getVUEParams(""),
        s_tech_process: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "28847805EE1D403DBCD43478FD18BD08",
        name: "检测范围右菜单",
        selected: "检测项目"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/techProcedure?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_process_id(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/product/TechnologyAction/d_process_id?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popProcedureChoice(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProcedureChoiceVisible = !this.ProcedureChoiceVisible;
      },
      popProcessChar(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProcessCharVisible = !this.ProcessCharVisible;
      },
    },
  }
</script>
